package com.geline.mybatisplus.annotation;

import java.lang.annotation.*;

/**
 * 提取原始字段汇总值
 * @ExtractKey(value="统计查询sqlA", fromTables="来源表（非必须）")
 * @ExtractKey(sqlIdInMapper="Mapper.sqlId")
 *
 * @author mx
 * @date 2025/8/24
 */
@Repeatable(ExtractKeys.class)
@Documented
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ExtractKey {

    //提取sql: select sum(price) from tableName
    String value() default "";

    //触发来源表，支持多个；可以不填默认识别from table判断与来源表是否一致
    String fromTables() default "";

    //mybatis.xml <sql id="{statementId: 唯一key，可以放在任意Mapper.xml中}"></sql>
    String sqlIdInMapper() default "";

    //执行顺序(从小到大运行)
    int order() default 1;
}
